package com.foreknow.demo3;

import java.util.Scanner;

/**
 * 方法练习
 */
public class MethodDemo3 {
    public static void m1() {
        System.out.println("1111111111111");
    }

    public static int[] m2(int[] b) { //{1,2,3}
        return b;
    }

    public static String m3(String a,String b) {
        return a +"---" + b;
    }

    public static int m4(int a,int b) {
        return a + b;
    }

    public static void m5(int[] arr) {
        for(int i = 0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
    }

    public static int[] m6(int[] array) {
//        int[] array = {1,2,3,4,5};
        return array;
    }

    public static void m7(Scanner input) {
        System.out.println("请输入用户名： ");
        String name = input.next();
        System.out.println(name);
    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        MethodDemo3.m7(input);

        System.out.println("----------------------------");

        int[] array = {1,2,3,4,5};
        MethodDemo3.m5(array);
        System.out.println("---------------------------------------");
        int[] arr = MethodDemo3.m6(array);
        for(int i = 0;i<arr.length;i++){
            System.out.println(arr[i]);
        }

        System.out.println("------------------------------");
        int[] a = {1,2,3};
        int[] k = MethodDemo3.m2(a);
        for(int i = 0;i<k.length;i++){
            System.out.println(k[i]);
        }
    }


}
